package com.grape.crm.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.grape.crm.domain.Customer;

public interface CustomerRepository extends JpaRepository<Customer, Integer>{

	List<Customer> findByFixedAreaIdIsNull();

	List<Customer> findByFixedAreaId(String b1);
	
	@Query("update Customer set fixedAreaId = ? where id = ?")
	@Modifying
	void updateFixedAreaId(String str, Integer c1);
	
	@Query("update Customer set fixedAreaId = null where fixedAreaId = ?")
	@Modifying
	void clearFixedAreaId(String c1);
	
	
	List<Customer> findByTelephoneIs(String telephone);

	Customer findByTelephoneAndPassword(String telephone, String password);
	
	
	Customer findByAddress(String address);
}
